import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_excel('某店铺促销方式分析.xlsx')
plt.rcParams['font.sans-serif'] = 'SimHei'
plt.pie(x=df['购买人数'],labels=df['促销方式'],
        autopct='%.2f%%',startangle=90,counterclock=False,
        wedgeprops={'linewidth':1,'edgecolor':'white'})
plt.title('某店铺不同促销方式下购物人数占比饼图')
plt.show()

import pandas as pd
import matplotlib.pyplot as plt
file_path='男子体能测试成绩.xlsx'
data=pd.read_excel(file_path)
grades=data['成绩等级']
grade_counts=grades.value_counts()
plt.figure(figsize=(8,8))
plt.pie(grade_counts,autopct='%1.1f%%',startangle=90,pctdistance=0.9,textprops={'fontsize':13,'color':'w'})
plt.title('男子体能测试成绩等级占比饼图',fontsize=20)
plt.rcParams['font.sans-serif'] = 'SimHei'
plt.legend(grade_counts.index)
plt.show()